<template>
	<view class="page-body">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="{use: false}">
		<view class="indexBg"></view>
		<view id="indexTop" :style="'padding-top:'+top+'px'">
			<view class='indexTop clearfix'>
				<!-- <router-link v-if="appConfig.is_open_nearby" class="cityShow white fl" to="/pages/index/city">
					<text class="m-r-6">{{ cityInfo.name || '选择' }}</text>
					<u-icon name="arrow-down" size="24" color="#FFFFFF"></u-icon>
				</router-link> -->
				<!-- <image v-if="!appConfig.is_open_nearby" class="fl logo" :src="appConfig.shop_login_logo"> -->
				<image class="fl logo" :src="appConfig.shop_login_logo">
				<view class="fl searchBox clearfix" @click="toSearch">
						<uni-icons class="fl" type="search" size="20" color="#C4C4C4"></uni-icons>
						<view class="fl s-txt">搜索您要的商品</view>
				</view>
			</view>
		</view>
		<view class="gridBg pad24" :style="'padding-top:'+bannerTop+'px'">
			<uni-grid :column="4" :showBorder="false" :highlight="false">
				<uni-grid-item class="navGrid"  v-for="(item,index) in menuList" v-if="index<=3">
					<view @click="getnavGrid(item)">
						<!-- <router-link class="" :to="{path: item.link}"> -->
							<image class="gridImg" :src="item.image"/>
							<view class="gridText">{{item.name}}</view>
						<!-- </router-link> -->
					</view>
				</uni-grid-item>
				<uni-grid-item class="navGrid"  v-for="(item,index) in menuList" v-if="index>3">
					<router-link class="" :to="{path: item.link}">
						<image class="gridImg" :src="item.image"/>
						<view class="gridText">{{item.name}}</view>
					</router-link>
				</uni-grid-item>
			</uni-grid>
		</view>
		<view style="position: relative;" @click="toInvite('/bundle/pages/invite')">
			<view class="yqText">每邀请1人获得{{yaoqingIntegral}}积分</view>
			<image class="indexYq" src="https://fx.senge.com/uploads/mini/sengeimg/indexYaoqings.png" mode="widthFix"/>
		</view>
		<view class="">
			
		</view>
		<view style="margin-top: 12rpx;">
			<uni-grid :column="4" :showBorder="false" :highlight="false">
				<uni-grid-item class="navGrid" v-for="item in mainNavList">
					<!-- 用router-link的to 不识别判断 -->
					<view class="" v-if="item.type=='page'||item.type=='pages'" @click="navi(item)">
						<view class="imgbox">
							<view class="dot" v-if="item.type=='pages'&&unreadnum==true"></view>
							<image class="navIcon" :src="item.image"/>
						</view>
						<view class="navText">{{item.name}}</view>
					</view>
					<router-link v-if="item.type=='tab'" class="" :to="{path: item.link}" navType="pushTab">
						<image class="navIcon" :src="item.image"/>
						<view class="navText">{{item.name}}</view>
					</router-link>
					<view v-if="item.type=='btn'">
						<button  open-type="contact" hover-class="btn-hover" style="line-height: normal;">
							<view>
								<image class="navIcon" :src="item.image"/>
								<view class="navText">{{item.name}}</view>
							</view>
						</button>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
		<!-- <view>
			<router-link v-if="headLines.length" class="" :to="{path: '/pages/index/news_list'}">
				<uni-notice-bar showIcon scrollable single background-color="#f5f6fa" color="#A09E9E" :text="headLines[0].title"></uni-notice-bar>
			</router-link>
		</view> -->
		<!-- <view class="pad24">
			<uni-grid :column="5" :showBorder="false">
				<uni-grid-item v-for="item in menuList">
					<router-link v-if="headLines.length" class="" :to="{path: item.link}">
						<image class="gridImg" :src="item.image"/>
						<view class="gridText">{{item.name}}</view>
					</router-link>
				</uni-grid-item>
			</uni-grid>
		</view> -->
		<!-- @click="switched(item.id)" -->
<!-- 		<view class="switched flex-center" v-if="shop_lists.length">
			<view class="switched_item" :class="activenav1 === index ? 'activenav1':''" @click="navclick1(index,item.id)"
			v-for="(item,index) in shop_lists" >{{item.name}}</view>
		</view> -->
		<view>
			<liu-slide-img :list="bannerList" :type="2" :autoplay="autoplay" :interval="interval" :heightNumber="336" :borderRadius="16" @click="bannerTap"></liu-slide-img>
		</view>
		<view class="mapbox">
			<view class="syy">
				<view class="syybox flex-start">
					<image class="Nearbyimg"src="https://fx.senge.com/images/menu/ditu.jpg" mode=""></image>
					<view class="Nearby">您身边的森歌门店</view>
				</view>
			</view>
			<map id="maps" :style="'margin:26rpx 0; width: 750rpx; height: 566rpx;'"  :scale="scale" :latitude="latitude" :longitude="longitude" 
			:markers="alist" @markertap="markertap"@callouttap="callouttap"@regionchange="dwdis"
			 :show-location='true'></map>
			<view class="xyy"></view>
			<!-- 返回初始位置点 -->
			<!-- <cover-view class="mapControl" v-if="isdwd" >
				<cover-image class="controlIcon" src="../../static/image/locationIcon.png" @click="backLocation"></cover-image>
			</cover-view> -->
		</view>

		 
		<view class="pad24">
<!-- 			<view class="indexBox" style="margin-top: 40rpx;">
				<view class="clearfix">
					<router-link class="" :to="{path: '/bundle/pages/goods_cate/goods_cate'}">
						<view class="i-title fl">专属推荐<text style="color: #999;font-size: 24rpx;margin-left: 20rpx">({{nearby_shops.name}})</text></view>
						<view class="fr">
							<text class="moreTxt">更多</text><uni-icons type="right" size="16" color="#666666"></uni-icons>
						</view>
					</router-link>
				</view>
				<view class="i-b-list clearfix">
					<view class="zhuanItem" v-for="(item,index) in levelOneList" v-if="index<4">
						<router-link :to="{path: '/pages/index/goods_search', query: {
							id: item.id,
							name: item.name,
							type: 1
						}}"
							class="nav-item">
							<image class="zhuanImg" :src="item.bg_image"/>
						</router-link>
					</view>
				</view>
			</view> -->
			<!-- 店铺 -->
			<!-- <view class="m-t-20"  v-if="shop_lists.length">
				<shop-recommend type="shop-recommends"  title="店铺推荐" :list="shop_lists"></shop-recommend>
			</view> -->
		</view>
			<view class="indexBox" style="padding: 30rpx 20rpx; background: linear-gradient(#fe5f85,#fea9b2);
			border-radius: 30rpx;border: 4rpx solid #fedfa9;">
				<view class="clearfix">
					<router-link class="" :to="{path: '/bundle/pages/goods_cate/goods_cate'}">
						<view class="i-title fl">
							<image class="cnxh" src="https://fx.senge.com/uploads/mini/sengeimg/cnxh.png" mode=""></image>
						</view>
						<view class="fr">
							<image class="gogo" src="https://fx.senge.com/uploads/mini/sengeimg/gogo.png" mode=""></image>
						</view>
					</router-link>
				</view>
				<view class="i-b-list clearfix" >
					<swiper class="swiperNew" circular indicator-dots indicator-color="#EBF1F8" indicator-active-color="#f5335e">
						<swiper-item>
							<view class="swiper-item">
								<view class="s-new-item" v-for="(item,index) in newList" v-if="index>=0&&index<3" @click="toGoodsDetail(item.id)">
									<image class="newImg" :src="item.image" mode="aspectFill"/>
									<view class="pad24 newBottom">
										<view class="newTxt ellipsis">{{item.name}}</view>
										<!-- <view class="newTag" v-if="item.remark">{{item.remark}}</view> -->
										<view class="numbox">
											<price-format :color="'#ff2d66'" class="m-r-10" :first-size="32" :second-size="25"
											:subscript-size="24" :price="item.min_price" :weight="500"></price-format>
										</view>
									</view>
								</view> 
							</view>
						</swiper-item>
						<swiper-item v-if="newList.length>3">
							<view class="swiper-item">
								<view class="s-new-item" v-for="(item,index) in newList" v-if="index>=3&&index<6" @click="toGoodsDetail(item.id)">
									<image class="newImg" :src="item.image" mode="aspectFill"/>
									<view class="pad24 newBottom">
										<view class="newTxt ellipsis">{{item.name}}</view>
										<!-- <view class="newTag" v-if="item.remark">{{item.remark}}</view> -->
										<view class="numbox">
											<price-format :color="'#ff2d66'" class="m-r-10" :first-size="32" :second-size="25"
											:subscript-size="24" :price="item.min_price" :weight="500"></price-format>
										</view>
									</view>
								</view>
							</view>
						</swiper-item>
						<swiper-item v-if="newList.length>6">
							<view class="swiper-item">
								<view class="s-new-item" v-for="(item,index) in newList" v-if="index>=6&&index<9" @click="toGoodsDetail(item.id)">
									<image class="newImg" :src="item.image" mode="aspectFill"/>
									<view class="pad24 newBottom">
										<view class="newTxt ellipsis">{{item.name}}</view>
										<!-- <view class="newTag" v-if="item.remark">{{item.remark}}</view> -->
										<view class="numbox">
											<price-format :color="'#ff2d66'" class="m-r-10" :first-size="32" :second-size="25"
											:subscript-size="24" :price="item.min_price" :weight="500"></price-format>
										</view>
									</view>
								</view>
							</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
			 
			<uni-popup ref="popup" type="center" :is-mask-click="false">
				<view style="position: relative;">
					<view class="closePopBtn" @click="closePopTap">
						<image src="../../static/image/xx.png" mode=""></image>
					</view>
					<view v-if="yqPopImg.level!=1">
						<view class="popIntegral" >{{yaoqingIntegral}}</view>
						<image class="yqPop" mode="widthFix" :src="yqPopImg.image" @click="toInvite(yqPopImg.link)"/>
					</view>
					<image v-else class="yqPopBk" mode="widthFix" :src="yqPopImg.image" @click="toInvite(yqPopImg.link)"/>
				</view>
			</uni-popup>
		<!-- </view> -->
			<view class="indexBox" style="margin-top: 40rpx;">
				<view class="clearfix pad24">
					<router-link class="" :to="{path: '/pages/community/community'}" navType="pushTab">
						<view class="i-title fl">服务案例</view>
						<view class="fr">
							<text class="moreTxt">更多</text><uni-icons type="right" size="16" color="#666666"></uni-icons>
						</view>
					</router-link>
				</view>
				<view class="i-b-list clearfix">
					<u-waterfall ref="uWaterfall" v-model="serviceList" :add-time="50">
		                <template v-slot:left="{leftList}">
		                    <view style="padding:0 9rpx 0 30rpx">
		                        <community-list width="336rpx" type="waterfall" :list="leftList"></community-list>
		                    </view>
		                </template>
		                <template v-slot:right="{rightList}">
		                    <view style="padding:0 30rpx 0 9rpx;">
		                        <community-list width="336rpx" type="waterfall" :list="rightList"></community-list>
		                    </view>
		                </template>
		            </u-waterfall>
				</view>
			</view>
		<view class="indexIconBox">
			<view><button  open-type="contact" hover-class="btn-hover"><image class="indexIcon" src="../../static/image/indexIcon1.png" mode=""></image></button></view>
			<view v-if="userLevel!==4">
				<router-link class="" :to="{path: '/pages/mine/invite_fans'}">
					<image class="indexIcon" src="../../static/image/indexIcon2.png" mode=""></image>
				</router-link>
			</view>
		</view>
	</mescroll-body>
	</view>
</template>

<script>
	import {footprintUpLength,footprint_index,LeaderNearbyShop} from '@/api/store';
	import {mapState, mapMutations,mapGetters, mapActions} from 'vuex'; 
	import {
		getLevelOneList,
		getGoodsListColumn,
		getGoodsColumn,
		getAdList,
		getMenu,
		getHome,
		NearbyShops,
		// LeaderNearbyShop,
		apiDrawIntegral,
		unread
	} from "@/api/store"
	import {
		getCommunityArticleLists,
	} from "@/api/community"
	import {
		getConfig
	} from '@/api/app'
	import MescrollCompMixin from "@/components/mescroll-uni/mixins/mescroll-comp";
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
	import {
		setTabbar,
		strToParams
	} from '@/utils/tools';
		import {
			getUser
		} from '@/api/user'
	export default {
		mixins: [MescrollMixin, MescrollCompMixin],
		data() {
			return {
				isdwd:false,
				alist:[],
				latitude: 30.187073,
				longitude: 120.180495,
				DQlatitude: '',
				DQlongitude: '',
				covers: [
					{
						callout: {content: "恒纳国际大酒店", color: "#fff", bgColor: "#666", fontSize: 12, borderRadius: 5, padding: 5},
						height: 26,
						iconPath: "https://fx.senge.com/uploads/images/202304131527439c5417567.png",
						id: 3,
						latitude: 29.627479,
						longitude: 120.880322,
						title: "恒纳国际大酒店",
						width: 21,
					},
				],
				scale:15,//地图层级
				controls:[{//在地图上显示控件，控件不随着地图移动
					id:1,//控件id
					iconPath:'/static/image/icon_address.png ',//显示的图标	    
					position:{//控件在地图的位置
						left:15,
						top:15,
						width:25,
						height:25
					},	
				}],
				yaoqingIntegral:0,
				list: [{
                        src: "https://cdn.pixabay.com/photo/2020/05/19/13/32/cartoon-5190837_1280.jpg"
                    },
                    {
                        src: "https://cdn.pixabay.com/photo/2020/05/19/13/35/cartoon-5190860_1280.jpg"
                    },
                    {
                        src: "https://cdn.pixabay.com/photo/2022/03/31/14/53/camp-7103189_1280.png"
                    }
                ],
                autoplay: true,
                interval: 3000,
				yqPopImg:'',
				userLevel:'',
				footprint_indexID:'',
				unreadnum:false,
				levelOneList:[],
				headLines:[],
				shop_lists:[],
				top: 0,
				shop_id: '',
				shop_address_id: '',
				bannerTop:0,
				activenav1: '',
				menuList:[],
				bannerList:[],
				newList:[0,0],
				serviceList:[],
				nearby_shops:{},
				mainNavList:[ 
					{image:'/static/image/indexIcon3.png',name:'签到',link:'/bundle/pages/integral_sign',type:'page'},
					{image:'/static/image/indexIcon4.png',name:'商城',link:'/pages/mall/index',type:'tab'},
					{image:'/static/image/indexIcon5.png',name:'我的客户',link:'/bundle/pages/userlist/userlist?type=0',type:'page'},
					{image:'/static/image/indexIcon6.png',name:'我的奖品',link:'/bundle/pages/exchange_order/exchange_order',type:'page'},
					{image:'/static/image/indexIcon6.png',name:'订单',link:'/pages/mine/orderList?type=all',type:'page'},
					{image:'/static/image/indexIcon8.png',name:'客服',link:'',type:'btn'},
					{image:'/static/image/indexIcon9.png',name:'消息',link:'/bundle/pages/notice/notice',type:'pages'}, 
					{image:'/static/image/indexIcon10.png',name:'帮助',link:'/bundle_b/pages/news_list/news_list?type=1',type:'page'},
				]
			}
		},
		computed: { 
		 ...mapGetters(['appConfig', 'cityInfo']),
		 
		}, 
		async onShow(){
			// this.orientation()
			if(this.isLogin){
				await this.unread()
				this.getUserInfo();
		    }
			await this.getHomeData()
			this.LeaderNearbyShop()
			this.getpopup()
		},
		async onLoad(options) {
			// console.log('342',options)
			// this.orientation()
			// this.getmap()
			this.footprint_index()
			this.shop_id = ''
			this.activenav1 =''
			var that=this
			that.getCartNum()
			that.getConfigFun() 
			await this.getHomeData()
			//that.getGoodsListByColumnId(2)
			// 选择城市后是否刷新
			if(options?.refresh) await this.getHomeData()
			// 监听是否刷新页面，目前秒杀时会用到
			uni.$on('refreshhome', () => { this.getHomeData() })
			// that.getpopup()
			uni.getSystemInfo({
			    success: function (res) {
			    	that.bannerTop=0
			    	// #ifdef  MP-WEIXIN
					let menu = wx.getMenuButtonBoundingClientRect();
					that.top = menu.top
			    	wx.createSelectorQuery().select('.indexTop').boundingClientRect(function (rect) {
					  that.bannerTop=menu.top+rect.height
					}).exec()
					// #endif
			    }
			});
			
		},
		onHide(){
				this.footprintUpLength()
		},
		onUnload(){
			this.footprintUpLength()
		},
		methods: {
			...mapActions(['getCartNum', 'wxShare']), // 'initLocationFunc' 应该用于左上角获取定位，但地理位置信息 能力封禁
		 	...mapMutations(['setConfig']),  
			dwdis(){  //位置偏移改变时才再显示图标
				// this.isdwd = this.isdwd==false?true:false;
				this.isdwd = true; 
			},
			backLocation(){ 
				// console.log(32333)
				var that=this
				// uni.getLocation({//获取当前的位置坐标  目前没有门店的时候有用到经纬度
				// 	type: 'gcj02',
				// 	success: function (res) {
						// console.log('res',res)
						uni.createMapContext("maps", that).moveToLocation(
						// {
						// 	success: function (res) {
						// 		console.log(res)
						// 	},
						// 	fail: function (res) {
						// 		console.log(res)
						// 	}
						// }

						{
							longitude:that.longitude,
							latitude:that.latitude 
						}
						);
				// 	}
				// });  
			},
			getnavGrid(item){ 
				console.log(item)
				if(this.userLevel==4&&item.link=='/bundle/pages/succeed_push/succeed_push'){
					// this.apifun.toast('您无权限申请')
					uni.showToast({
						icon: 'none',
						// position: top,
						title: '您无权限申请',
						duration: 2800,
					});
				}else{
					this.apifun.navigate(item.link)
				}
			},
			getpopup(){
				var that=this
				if(that.isLogin){
					setTimeout(function(){
						//每天弹出一次邀请弹窗
						uni.getStorage({
							key: "popUp-show-time",
							success: (res) => {
								if (!res.data || new Date().getTime() - res.data > 1000 * 60*60*24) {
									uni.setStorage({
										key: "popUp-show-time",
										data: new Date().getTime(),
									});
									if(that.userLevel!==4){
										that.$refs.popup.open()
									}
								}else{
									that.$refs.popup.close()
								}
							},
							fail: (err) => {
								if(that.userLevel!==4){
									that.$refs.popup.open()
								}
							},
						});
						
					},700)
				}
			},
			orientation(){
				var that=this
				uni.getLocation({//获取当前的位置坐标  目前没有门店的时候有用到经纬度
					type: 'gcj02',
					success: function (res) { 
						console.log('res',res)
						// that.DQlongitude=res.longitude  //用that
						// that.DQlatitude=res.latitude
						// that.getMapStores(res.DQlongitude,res.latitude)
					},
					fail:(err)=>{
						console.log('err',err)
					}
				});  
			},
			callouttap(e){
				uni.navigateTo({  //点击气泡事件
					url:'/bundle_b/pages/iddetail?shop_address_id='+e.detail.markerId
				})
			},
			markertap(e) { //点击定位点事件
				for(var i=0;i<this.shop_lists.length;i++){
					if(e.detail.markerId==this.shop_lists[i].shop_address_id){
						this.shop_id=this.shop_lists[i].id
						this.getHomeData()
					}
				}
			},
			// 获取当前地图中心的经纬度
			getCenterLanLat() {
				this.mapContext = uni.createMapContext("maps", this);
				this.mapContext.getCenterLocation({
					type: 'gcj02',
					success: (res) => {
						let address = {
							latitude: res.latitude,
							longitude: res.longitude
						}
						this.longitude=res.longitude
						this.latitude=res.latitude
						console.log('2322',this.latitude)
						this.getMapStores(res.longitude,res.latitude)
					},
					fail:(err)=>{
						console.log(this.latitude)
					}
				})
			},
			getMapStores(longitude,latitude){
				this.showStore=false
				var locationData={}
				locationData.longitude=longitude
				locationData.latitude=latitude
				// this.$api.getMapStores(locationData).then(res => {
			 //       	if(res.data.code=="200"){
			 //       		this.covers=res.data.data
			 //       	}else{
			 //       		uni.showToast({title: res.data.message,icon: 'none'});
			 //       	}
			 //    })
			},
			navi(option){
				// if(option.name=='订单'&&this.userLevel==4){
				// 	uni.navigateTo({
				// 		url: '/bundle_b/pages/user_spread_order/user_spread_order?type=0'
				// 	});
				// }else{
					uni.navigateTo({
						url: option.name=='我的客户'&&this.userLevel==1?'/bundle/pages/succeed_push/succeed_push':option.name=='订单'&&this.userLevel==4?'/bundle_b/pages/user_spread_order/user_spread_order?type=0':option.link
					});
				// }
					
			},
			footprint_index(){
				footprint_index({  //获取访问时间id
				}).then(({
					data
				}) => {
				this.footprint_indexID= data.footprint_id;
				})
			},
			async footprintUpLength() {   //传访问时间id
				if(this.footprint_indexID!=0||this.isLogin){
					const {
						data,
						code
					} = await footprintUpLength({
						id: this.footprint_indexID
					});
					if (code == 1) {
						console.log(3000)
					} 
				}
			},
			navclick1(type,id) { //切换
				this.activenav1 = type;
				// this.cityInfo.id =''
				this.shop_id = id
				this.getHomeData()
			},
			async getUserInfo(){
				const {
					data,
					code
				} = await getUser({})
				if (code == 1) {
					this.userLevel = data.level
				}
			},
			async getConfigFun() {
				const {
					code,
					data
				} = await getConfig()
				if (code == 1) {
					this.setConfig(data)
					if(data.is_open_nearby) {
						// 获取定位
					}
					setTabbar()
					// 防止第一次调用时拿不到数据
					this.wxShare()
				}
			},
			async downCallback() {
				await this.getMenuList()
				//await this.getBannerList()
				await this.getHomeData()
				// await this.getNearbyShops()
				await this.getCommunityArticleLists()
				await this.getLevelOneList()
				await this.apiDrawIntegral()
				this.mescroll.endSuccess(0, false)
			},
			toSearch(){
				uni.navigateTo({
					url:'/pages/index/goods_search'
				})
			},
			closePopTap(){
				this.$refs.popup.close()
				uni.setStorage({
					key: "popUp-show-time",
					data: new Date().getTime(),
				});
			},
			toInvite(link){
				// console.log(link+'?'+this.nearby_shops.id)
				if(this.userLevel!==4){
					uni.navigateTo({
						url:link+'?id='+this.nearby_shops.id
					})
					this.$refs.popup.close()
				}
			},
			// getGoodsListByColumnId(id){
			// 	let that = this;
			// 	getGoodsListColumn({
			// 		column_id: id
			// 	}).then(({
			// 		data
			// 	}) => {
			// 		that.newList = data.lists;
			// 	})
			// },
			async getLevelOneList() {
				const {
					code,
					data
				} = await getLevelOneList({})
				if (code == 1) {
					this.levelOneList = data
				}
			},
			async unread() {
				const {
					code,
					data
				} = await unread({})
				if (code == 1) {
					this.unreadnum = data.num
				}
			},
			async getHomeData() {
				const {
					code,
					data
				} = await getHome({
					district_id:this.cityInfo.id,
					shop_id:this.shop_id
					}) 
				if (code == 1) {
					// console.log('indexdata',data)
					this.headLines = data.headlines;
					this.newList=data.news
					var bannerArr=data.nearby_shops.banner_list
					this.bannerList=[]
					// this.getNearbyShops()
					this.LeaderNearbyShop()
					for(var i=0;i<bannerArr.length;i++){
						this.bannerList.push({
							src:bannerArr[i].image,
							link:bannerArr[i].link,
							id:bannerArr[i].params.id||'',
						})
					}
					this.nearby_shops=data.nearby_shops
					this.yqPopImg=data.tan_new
					uni.setStorage({
						key: "nearby_shops",
						data: data.nearby_shops.id,
					});
					uni.setStorageSync('bao_shopId',data.bao_shop.id)
					// console.log('9865',uni.getStorageSync('nearby_shops')) 
					// console.log('9965',uni.getStorageSync('bao_shopID')) 
				}
			},
			bannerTap(index){
				// console.log('id',this.bannerList[index].id)
				uni.navigateTo({
					url:this.bannerList[index].link+'?id='+this.bannerList[index].id
				})
			},
			async apiDrawIntegral(){
				const {
					code,
					data
				} = await apiDrawIntegral({})
				if (code == 1) {
					this.yaoqingIntegral = data[0]
				}
			},
			async getBannerList() {
				const {
					code,
					data
				} = await getAdList({
					pid: 7,
					terminal: 1
				})
				if (code == 1) {
					this.bannerList = data;
				}
			},
			async getMenuList() {
				const {
					data,
					code
				} = await getMenu({
					type: 1,
				})
				if (code == 1) {
					this.menuList = data
				}
			},
			async getCommunityArticleLists() {
				const {
					data,
					code
				} = await getCommunityArticleLists({
					page_size: 10,page_no: 1
				})
				if (code == 1) {
					this.serviceList=data.list
				}
			},
			toCase(item){
				uni.navigateTo({
					url:'/pages/case/casedetail?id='+item.id
				})
			},
			toGoodsDetail(id){
				uni.navigateTo({
					url:'/bundle/pages/goodsDetail/index?id='+id
				})
			},
			async LeaderNearbyShop(){
				const {
					code,
					data
				} = await LeaderNearbyShop() 
				if (code == 1) {
					this.shop_lists = data;
					this.latitude = this.shop_lists!='' ? this.shop_lists.shop_address_info.latitude : this.DQlatitude;
					this.longitude = this.shop_lists!='' ? this.shop_lists.shop_address_info.longitude : this.DQlongitude;
					// console.log('this.shop_lists',this.shop_lists)
					// console.log('this.longitude',this.longitude)
					// console.log('this.DQlongitude',this.DQlongitude) 
					if(this.shop_lists!=''){
						// console.log(1111)
						let selllist = [];
						this.shop_lists.shop_address_list.forEach((item, index) => {
							selllist.push({
								callout: {content: this.shop_lists.name, color: "#fff", bgColor: "#fa5975", fontSize: 12, borderRadius: 5, padding: 5},
								// title:item.name,
								iconPath:'https://fx.senge.com/images/menu/ditu.jpg',
								height: 24,
								width: 24,
								id: item.id,
								latitude: item.latitude,
								longitude: item.longitude,
							});
						})
						this.alist = [ ...selllist];
						// console.log('alist777',this.alist)
						// that.shoplist = [...list, ...selllist];
					}

				}
			},
			// async getNearbyShops(){
			// 	const {
			// 		code,
			// 		data
			// 	} = await NearbyShops({
			// 		district_id:this.cityInfo.id,
			// 		}) 
			// 	if (code == 1) {
			// 		this.shop_lists = data;
			// 		let selllist = [];
			// 		this.shop_lists.forEach((item, index) => {
			// 			selllist.push({
			// 				callout: {content: item.name, color: "#fff", bgColor: "#fa5975", fontSize: 12, borderRadius: 5, padding: 5},
			// 				// title:item.name,
			// 				iconPath:'https://fx.senge.com/images/menu/ditu.jpg',
			// 				height: 22,
			// 				width: 22,
			// 				id: item.shop_address_id,
			// 				latitude: item.shop_address_info.latitude,
			// 				longitude: item.shop_address_info.longitude,
			// 			});
			// 		})
			// 		this.alist = [ ...selllist];
			// 		console.log('777',this.alist)
			// 		// that.shoplist = [...list, ...selllist];
			// 	}
			// },
		}
	}
</script>
<style>
	.mapControl{
		position: absolute;
		left: 30rpx;
		bottom: 46rpx;
		background:transparent;
	}
	.controlIcon{
		display: block;
		width: 74rpx;
		height: 74rpx;
		margin-bottom: 25rpx;
	}
.swiper .wx-swiper-dots-horizontal .wx-swiper-dot{
	margin-right: 0;
	width: 40rpx!important;
	border-radius: 0;
	height: 6rpx;
}
.swiperNew .wx-swiper-dots-horizontal .wx-swiper-dot{
	width: 40rpx!important;
	border-radius: 0;
	height: 6rpx;
}
.cnxh{
	width: 156rpx;
	height: 56rpx;
}
.gogo{
	width: 110rpx;
	height: 50rpx;
}
.numbox{
	background-color: #fee4ac;
	text-align: center;
	margin: 10rpx 0;
	padding: 4rpx ;
	border-radius: 50rpx;
}
.mapbox{
	position: relative;
}
.syy{
	z-index: 3;
	background: linear-gradient(#f5f5f5,transparent);
	width: 100%;
	height: 100rpx;
	position: absolute;
	top: 0rpx;
}
.syybox{
	width: 630rpx;
	background-color: #f9f9f9;
	padding: 14rpx 40rpx;
	border-radius: 60rpx;
	margin: 10rpx auto;
	border: #b0adad 1rpx solid;
}
.xyy{
	z-index: 3;
	background: linear-gradient(transparent,#ffffff);
	width: 100%;
	height: 100rpx;
	position: absolute;
	bottom: 0rpx;
}
.Nearby{
	margin-left: 16rpx;
	font-size: 28rpx;
	color: #585656;
	/* color: #4b4b4b; */
}
.Nearbyimg{
	width: 44rpx;
	height: 44rpx;
}
</style>
<style scoped>
    @import './index.css';
</style>
